<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// pogostick, jQuery complete extension.
Yii::setPathOfAlias('pogostick','D:/xampp2/library/yii/pogostick/');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
$config = array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'DUREN: DUO KEREN',

	// preloading 'log' component
	'preload'=>array('log'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.components.*',
		
		'pogostick.base.*',
		'pogostick.behaviors.*',
		'pogostick.components.*',
		'pogostick.events.*',
		'pogostick.helpers.*',
		'pogostick.widgets.*',
		'pogostick.widgets.jqui.*'
	),

	// application components
	'components'=>array(
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
				),
			),
		),
		'user'=>array(
			// enable cookie-based authentication
			'allowAutoLogin'=>true,
		),
		
		'db'=>array(
			'class'=>'CDbConnection',
			'connectionString' => 'mysql:host=localhost;dbname=duren', 'username'=>'duren', 'password'=>'duren'
		)
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=>array(
		// this is used in contact page
		'adminEmail'=>'blackjenova@gmail.com',
	),
	
	'modules'=>array(),
	
	'theme'=>'classic',

	'language'=>'id'
);

$connection=new CDbConnection(
	$config['components']['db']['connectionString'],
	$config['components']['db']['username'],
	$config['components']['db']['password']
);

$connection->setActive(true);

$command=$connection->createCommand("SELECT * FROM sys_module WHERE sm_state = 1");
$reader=$command->query();

foreach($reader as $row){
	$modules[$row['sm_name']] = array();
	$imports[] = 'application.modules.'.$row['sm_name'].'.models.*';
	$imports[] = 'application.modules.'.$row['sm_name'].'.components.*';
}

$config['import']  = array_merge($config['import'],$imports);
$config['modules'] = array_merge($config['modules'],$modules);

$connection->setActive(false);

return $config;